package com.fh.shop.api.task;

import com.fh.shop.api.product.mapper.IProductMapper;
import com.fh.shop.api.product.po.Product;
import com.fh.shop.api.product.po.ProductItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class StockJob {

    @Autowired
    private IProductMapper productMapper;

    @Scheduled(cron = "0 * * * * ?")
    public void checkStock() {
        // 查询商品表中数量<10的所有商品
        List<ProductItem> productList =productMapper.findListByStock(10);
        // 发送邮件


    }
}
